package com.heima.demo;
/*
获取class对象的3种方式
 */
public class ReflectDemo {
    public static void main(String[] args) throws ClassNotFoundException {
        //1.class.forname("包名+类名");
        Class clazz = Class.forName("com.heima.demo.ReflectDemo");
        System.out.println(clazz);
        //2.类名.class
        Class clazz1 = ReflectDemo.class;
        System.out.println(clazz1);
        //3.利用class对象的getclass方法来获取class对象
        //getclass方法是定义在Object类中
        ReflectDemo  s = new ReflectDemo();
        Class clazz2 = s.getClass();
        System.out.println(clazz2);

        System.out.println(clazz ==clazz1);
        System.out.println(clazz1==clazz2);
    }
}
